package com.books.mapper.comment;

import com.books.model.entity.comment.Comment;
import com.books.model.entity.pianhao.Hobbies;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author 饿熊的咆哮
 * @Date 2021/10/13 16:10
 * @Version 1.0
 */
@Mapper
public interface CommentMapper {
    @Select("select * from comment where book_id=#{bookId} and book_type_id=#{bookTypeId} order by comment_id desc")
    List<Comment> findCommentByBookId(Integer bookId,Integer bookTypeId);

    @Insert("insert into comment values (null,#{peopleId},#{bookId},#{bookTypeId},#{commentTime},#{commentStar},#{comment})")
    void addComment(Comment comment);

    @Select ("select * from comment where people_id=#{peopleId}")
    List<Comment> findCommentByPeopleId(Integer peopleId);

    @Insert ("insert into user_pianhao_data1 values(null,#{uid},#{pid},#{val},#{time})")
    void addHobbies(Hobbies hobbies);
}
